package com.distribute.framework.model;

import com.distribute.framework.core.web.helper.Utils;
import java.lang.reflect.Field;
import java.util.Date; 
import java.util.Map;
import java.util.HashMap;
import java.util.List;
import java.util.ArrayList;

import javax.annotation.Resource;

import com.distribute.framework.core.web.util.Page;
import com.distribute.framework.core.lang.*; 
import com.distribute.framework.core.web.helper.WebHelper.LzMap;
import com.distribute.framework.core.util.Function;
import com.distribute.framework.core.util.IbatisMap;
import com.distribute.framework.config.*;
import com.distribute.framework.plugin.*;

@namespace("finance/incomerecord")
public @caption("会员收益记录") @database(DatabaseNames.distribute_sys) @source("distribute_sys") @table("income_record") class IncomeRecord implements java.io.Serializable
{
	private static final long serialVersionUID = 1l;
		
	
		
	private @caption("编号") @column("id")    @primary  @notnull  @note("  ") Long id;// 主键 非空     
			
 			
 			
 		
	
		
	private @caption("用户身份") @column("user_type")      @note(" 1:普通会员 2:代理 3:合伙人  ") Short userType;// 1:普通会员 2:代理 3:合伙人     
			
 			
 			
 		
	
		
	private @caption("来源") @column("source")      @note(" 1:直接购买 2:余额充值 3:代理卡购买 4:合伙人卡购买  ") Short source;// 1:直接购买 2:余额充值 3:代理卡购买 4:合伙人卡购买     
			
 			
 			
 		
	
		
	private @caption("收益类型") @column("revenue_type")      @note(" 1:直接 2:间接  ") Short revenueType;// 1:直接 2:间接     
			
 			
 			
 		
	
		
	private @caption("贡献收益") @column("income")      @note("  ") Double income;//     
			
 			
 			
 		
	
		
	private @caption("头像") @column("head_portrait") @like     @note("  ") String headPortrait;//     
			
 			
 			
 		
	
		
	private @caption("姓名") @column("full_name")      @note("  ") String fullName;//     
			
 			
 			
 		
	
		
	private @caption("贡献人名称") @column("incomers_name") @like     @note("  ") String incomersName;//     
			
 			
 			
 		
	
		
	private @caption("收益人姓名") @column("incomer_name") @like     @note("  ") String incomerName;//     
			
 			
 			
 		
	
		
	private @caption("贡献人") @column("contributor")   @hidden    @relate("$contributor") @RelateClass(Member.class)  @note("  ") Long contributor;//     
			
 	private transient Member $contributor;//关联对象[会员信息]
 			
 			
 			
 		
	
		
	private @caption("收益人") @column("beneficiary")   @hidden    @relate("$beneficiary") @RelateClass(Member.class)  @note("  ") Long beneficiary;//     
			
 	private transient Member $beneficiary;//关联对象[会员信息]
 			
 			
 			
 		
	
		
	private @caption("订单编号") @column("order_number")      @note("  ") String orderNumber;//     
			
 			
 			
 		
	
		
	private @caption("品牌信息") @column("brands")      @relate("$brands") @RelateClass(Merchant.class)  @note("  ") Long brands;//     
			
 	private transient Merchant $brands;//关联对象[品牌信息]
 			
 			
 			
 		
	
		
	private @caption("结算情况") @column("end_status")      @note(" 1:待结算 2:已结算  ") Short endStatus;// 1:待结算 2:已结算     
			
 			
 			
 		
	
		
	private @caption("修改时间") @column("update_time")     @notnull  @note("  ") Date updateTime;// 非空     
			
 			
 			
 		
	
		
	private @caption("添加时间") @column("add_time")     @notnull  @note("  ") Date addTime;// 非空     
			
 			
 			
 		
	
		
	private @caption("状态") @column("status")     @notnull  @note(" 1:正常 0:无效  ") Short status;// 非空 1:正常 0:无效     
			
 			
 			
 		
	
	 
	//默认构造函数
	public IncomeRecord(){ 
	
	}
	
	//主键构造函数
	public IncomeRecord(Long id){
		this.id = id;
	}
	
	/**所有字段构造函数 
	 IncomeRecord(
	 	Utils.getShort("type")//用户身份
	 	,Utils.getShort("")//来源
	 	,Utils.getShort("type")//收益类型
	 	,Utils.getDouble("")//贡献收益
	 	,Utils.getString("portrait")//头像
	 	,Utils.getString("name")//姓名
	 	,Utils.getString("name")//贡献人名称
	 	,Utils.getString("name")//收益人姓名
	 	,Utils.getLong("")//贡献人
	 	,Utils.getLong("")//收益人
	 	,Utils.getString("number")//订单编号
	 	,Utils.getLong("")//品牌信息
	 	,Utils.getShort("status")//结算情况
	 	,Utils.getDate("time")//修改时间 [非空]
	 	,Utils.getDate("time")//添加时间 [非空]
	 	,Utils.getShort("")//状态 [非空]
	 )
	**/
	public IncomeRecord(Short userType,Short source,Short revenueType,Double income,String headPortrait,String fullName,String incomersName,String incomerName,Long contributor,Long beneficiary,String orderNumber,Long brands,Short endStatus,Date updateTime,Date addTime,Short status){
		
			
			
		this.userType=userType;
		
			
		this.source=source;
		
			
		this.revenueType=revenueType;
		
			
		this.income=income;
		
			
		this.headPortrait=headPortrait;
		
			
		this.fullName=fullName;
		
			
		this.incomersName=incomersName;
		
			
		this.incomerName=incomerName;
		
			
		this.contributor=contributor;
		
			
		this.beneficiary=beneficiary;
		
			
		this.orderNumber=orderNumber;
		
			
		this.brands=brands;
		
			
		this.endStatus=endStatus;
		
			
		this.updateTime=updateTime;
		
			
		this.addTime=addTime;
		
			
		this.status=status;
		
	}
	
	//设置非空字段
	public IncomeRecord setNotNull(Date updateTime,Date addTime,Short status){
		
			
			
			
			
			
			
			
			
			
			
			
			
			
			
			
		this.updateTime=updateTime;
		
			
		this.addTime=addTime;
		
			
		this.status=status;
		
		return this;
	}
	
	
		
	/** 编号 [非空]       **/
	public IncomeRecord id(Long id){
		this.id = id;
		this.setSeted(F.id);
		return this;
	}
	
		
	/** 用户身份    1:普通会员 2:代理 3:合伙人     **/
	public IncomeRecord userType(Short userType){
		this.userType = userType;
		this.setSeted(F.userType);
		return this;
	}
	
		
	/** 来源    1:直接购买 2:余额充值 3:代理卡购买 4:合伙人卡购买     **/
	public IncomeRecord source(Short source){
		this.source = source;
		this.setSeted(F.source);
		return this;
	}
	
		
	/** 收益类型    1:直接 2:间接     **/
	public IncomeRecord revenueType(Short revenueType){
		this.revenueType = revenueType;
		this.setSeted(F.revenueType);
		return this;
	}
	
		
	/** 贡献收益        **/
	public IncomeRecord income(Double income){
		this.income = income;
		this.setSeted(F.income);
		return this;
	}
	
		
	/** 头像        **/
	public IncomeRecord headPortrait(String headPortrait){
		this.headPortrait = headPortrait;
		this.setSeted(F.headPortrait);
		return this;
	}
	
		
	/** 姓名        **/
	public IncomeRecord fullName(String fullName){
		this.fullName = fullName;
		this.setSeted(F.fullName);
		return this;
	}
	
		
	/** 贡献人名称        **/
	public IncomeRecord incomersName(String incomersName){
		this.incomersName = incomersName;
		this.setSeted(F.incomersName);
		return this;
	}
	
		
	/** 收益人姓名        **/
	public IncomeRecord incomerName(String incomerName){
		this.incomerName = incomerName;
		this.setSeted(F.incomerName);
		return this;
	}
	
		
	/** 贡献人  [Member]      **/
	public IncomeRecord contributor(Long contributor){
		this.contributor = contributor;
		this.setSeted(F.contributor);
		return this;
	}
	
		
	/** 收益人  [Member]      **/
	public IncomeRecord beneficiary(Long beneficiary){
		this.beneficiary = beneficiary;
		this.setSeted(F.beneficiary);
		return this;
	}
	
		
	/** 订单编号        **/
	public IncomeRecord orderNumber(String orderNumber){
		this.orderNumber = orderNumber;
		this.setSeted(F.orderNumber);
		return this;
	}
	
		
	/** 品牌信息  [Merchant]      **/
	public IncomeRecord brands(Long brands){
		this.brands = brands;
		this.setSeted(F.brands);
		return this;
	}
	
		
	/** 结算情况    1:待结算 2:已结算     **/
	public IncomeRecord endStatus(Short endStatus){
		this.endStatus = endStatus;
		this.setSeted(F.endStatus);
		return this;
	}
	
		
	/** 修改时间 [非空]       **/
	public IncomeRecord updateTime(Date updateTime){
		this.updateTime = updateTime;
		this.setSeted(F.updateTime);
		return this;
	}
	
		
	/** 添加时间 [非空]       **/
	public IncomeRecord addTime(Date addTime){
		this.addTime = addTime;
		this.setSeted(F.addTime);
		return this;
	}
	
		
	/** 状态 [非空]   1:正常 0:无效     **/
	public IncomeRecord status(Short status){
		this.status = status;
		this.setSeted(F.status);
		return this;
	}
	
	
	
	/**
	* 克隆对象
	**/
	public IncomeRecord clone(){
		IncomeRecord clone = new IncomeRecord();
		
			
			
		clone.userType=this.userType;
		
			
		clone.source=this.source;
		
			
		clone.revenueType=this.revenueType;
		
			
		clone.income=this.income;
		
			
		clone.headPortrait=this.headPortrait;
		
			
		clone.fullName=this.fullName;
		
			
		clone.incomersName=this.incomersName;
		
			
		clone.incomerName=this.incomerName;
		
			
		clone.contributor=this.contributor;
		
			
		clone.beneficiary=this.beneficiary;
		
			
		clone.orderNumber=this.orderNumber;
		
			
		clone.brands=this.brands;
		
			
		clone.endStatus=this.endStatus;
		
			
		clone.updateTime=this.updateTime;
		
			
		clone.addTime=this.addTime;
		
			
		clone.status=this.status;
		
		return clone;
	}
	
	
	
	
	
	/**
	 * 根据ID取会员收益记录
	 * @param id
	 * @return
	 */
	public static @api IncomeRecord get(Long id){		
		return getIncomeRecordById(id);
	}
	
	
	
	/**
	 * 获取所有会员收益记录
	 * @return
	 */
	public static @api List<IncomeRecord> list(Map params,Integer size){
		return getIncomeRecordList(params,size);
	}
	/**
	 * 获取会员收益记录分页
	 * @return
	 */
	public static @api Page<IncomeRecord> page(Integer page,Integer size,Map params){
		return getIncomeRecordPage(page, size , params);
	}
	
	
	/**
	 * 根据查询条件取会员收益记录
	 * @param params
	 * @return
	 */
	public static @api IncomeRecord Get(Map params){
		return getIncomeRecord(params);
	}
	/**
	 * 获取会员收益记录数
	 * @return
	 */
	public static @api Long count(Map params){
		return getIncomeRecordCount(params);
	}
	/**
	 * 获取会员收益记录数
	 * @return
	 */
	public static @api <T> T eval(String eval,Map params){
		return getIncomeRecordEval(eval,params);
	}
	
	
	/**
	 * 获取会员收益记录图表统计数据
	 * @param params 查询条件
	 * @param sumKey 统计的字段
	 * @param groupKey 1:按年， 2：按月， 3：按周， 4：按日， 5：按小时， 6：月分， 7：日分， 8：点分
	 * @return
	 */
	public static @api List<Map> stats(Map params,C sumKey,C groupKey){
		return getIncomeRecordStats(params,sumKey,groupKey,-1);
	}
	/**
	 * 获取会员收益记录图表统计数据
	 * @param params 查询条件
	 * @param sumKey 统计的字段
	 * @param groupKey 分组的字段
	 * @param dateType 1:按年， 2：按月， 3：按周， 4：按日， 5：按小时， 6：月分， 7：日分， 8：点分
	 * @return
	 */
	public static @api List<Map> stats(Map params,C sumKey,C groupKey,int dateType){
		return getIncomeRecordStats(params,sumKey,groupKey,dateType);
	}
	
	
	/**
	 * 根据ID取会员收益记录
	 * @param id
	 * @return
	 */
	public static @api IncomeRecord getIncomeRecordById(Long id){		
		return getIncomeRecordDao().getIncomeRecordById(id);
	}
	
	
	
	
	/**
	 * 根据ID取会员收益记录的标识键值
	 * @param id
	 * @return
	 */
	public static @api String getKeyValue(Object key){
		Long id = Utils.parseLong(key);	
		if(id==null || id.longValue()==0 ){
			
			return null;
			
		}
		String value = null;
				
		if(value==null){
			IncomeRecord incomeRecord = get(id);
			if(incomeRecord!=null){
				String strValue = incomeRecord.getId$();
				
				
				value = strValue;
			}else{
				
				value = "{"+id+"}";
			}
		}
		
		/************LAZY3Q_ID_KEYVALUE************/
		/************LAZY3Q_ID_KEYVALUE************/
		return value;
	}	
	
	
	/**
	 * 获取当前对象的键值
	 * @return
	 */
	public String getKeyValue(){
		
		/************LAZY3Q_CODE_KEYVALUE************/
		/************LAZY3Q_CODE_KEYVALUE************/
		String keyValue = this.getId$();
		
		return keyValue;
	}
	
	
	/**
	 * 根据关键字精确查询会员收益记录对象
	 * @return
	 */
	public static @api IncomeRecord find(String key){
		if(Utils.empty(key))return null;
		Map params = new HashMap();
		if(key.toLowerCase().startsWith("id:"))//如果查询条件以id:开头，则按ID查询
			params.put("id", key.toLowerCase().replaceFirst("id:", ""));					
		else{//按标识查询，精确查询
			String strDefinex = "";
			
			strDefinex="(2=1 "+strDefinex+")";
			params.put("definex",strDefinex);
		}
		
		/************LAZY3Q_CODE_FIND************/
		/************LAZY3Q_CODE_FIND************/
		return IncomeRecord.getIncomeRecord(params);
	}
	
	
	/**
	 * 根据关键字查询会员收益记录
	 * @return
	 */
	public static @api List<Map> query(String key,int size,Map params,Boolean bObject){
		if(Utils.empty((String)params.get("asc")) && Utils.empty((String)params.get("desc")))//如果未传入排序字段
			params.put("desc","id");//那么，默认以主键降序，传给Dao层
		String strTerm=key;		
		if(!Utils.empty(strTerm)){
			if(strTerm.toLowerCase().startsWith("id:"))//如果查询条件以id:开头，则按ID查询
				params.put("id", strTerm.toLowerCase().replaceFirst("id:", ""));					
			else//按标识查询，模糊查询请带%
			{
				String strDefinex = "";
				
				strDefinex="(2=1 "+strDefinex+")";
				params.put("definex",strDefinex);
			}
		}
		
		
		/************LAZY3Q_CODE_QUERY************/
		/************LAZY3Q_CODE_QUERY************/
			
		List<IncomeRecord> list = page(0,size,params).getResult();
		
		/**
		* OK!取到数据拼成放入Map中，[{value,text,object:{...}},...]
		* value:数据ID，text:数据标识,object,整个对象
		**/
		List<Map> result = new java.util.ArrayList();
		for(IncomeRecord incomeRecord:list){
			Map map = new HashMap();
			map.put("key",incomeRecord.getId().toString());
			map.put("value", Utils.js(incomeRecord.getKeyValue()));
			if(bObject==true)
				map.put("object",incomeRecord);
			result.add(map);
		}
		
		
		/************LAZY3Q_AFTER_QUERY************/
		/************LAZY3Q_AFTER_QUERY************/
		
		return result;
	}
	
	
	
	/**
	 * 获取所有会员收益记录
	 * @return
	 */
	public static @api List<IncomeRecord> getIncomeRecordList(Map params,Integer size){
		return getIncomeRecordDao().getIncomeRecordList(params,0,size);
	}
	
	/**
	 * 获取会员收益记录分页
	 * @return
	 */
	public static @api Page<IncomeRecord> getIncomeRecordPage(Integer page,Integer size,Map params){
		if(page==null)page=0;
		if(size==null)size=20;
		return getIncomeRecordDao().getIncomeRecordPage(page, size , params);
	}
	
	/**
	 * 根据查询条件取会员收益记录
	 * @param params
	 * @return
	 */
	public static @api IncomeRecord getIncomeRecord(Map params){
		return getIncomeRecordDao().getIncomeRecord(params);
	}
	
	/**
	 * 保存一个会员收益记录
	 * @param incomeRecord
	 * @return
	 */
	public static @api IncomeRecord saveIncomeRecord(IncomeRecord incomeRecord){
		return getIncomeRecordDao().saveIncomeRecord(incomeRecord);
	}
	
	/**
	 * 根据条件更新会员收益记录
	 * @param values
	 * @param params
	 */
	public static @api int updateIncomeRecordByConfirm(Map values, Map params){
		return getIncomeRecordDao().updateIncomeRecordByConfirm(values,params);
	}
	
	/**
	 * 修改一个会员收益记录
	 * @param incomeRecord
	 * @return
	 */
	public static @api int updateIncomeRecord(IncomeRecord incomeRecord){
		return getIncomeRecordDao().updateIncomeRecord(incomeRecord);
	}
	
	/**
	 * 更新会员收益记录非空字段
	 * @param incomeRecord
	 */
	public static @api int updateIncomeRecord$NotNull(IncomeRecord incomeRecord){
		return getIncomeRecordDao().updateIncomeRecord$NotNull(incomeRecord);
	}
	
	/**
	 * 获取会员收益记录数
	 * @return
	 */
	public static @api Long getIncomeRecordCount(Map params){
		return getIncomeRecordDao().getIncomeRecordCount(params);
	}
		
		
	/**
	 * 获取会员收益记录自定义求和表达式,比如求和:eval="sum(id)"
	 * @return
	 */	
	public static @api <T> T getIncomeRecordEval(String eval,Map params){
		return getIncomeRecordDao().getIncomeRecordEval(eval,params);
	}
	
	
	/**
	 * 获取会员收益记录图表统计数据
	 * @param params 查询条件
	 * @param sumKey 统计的字段
	 * @param groupKey 分组的字段
	 * @param dateType 1:按年， 2：按月， 3：按周， 4：按日， 5：按小时， 6：月分， 7：日分， 8：点分
	 * @return
	 */
	public static @api List<Map> getIncomeRecordStats(Map params,C sumKey,C groupKey,int dateType){
		//TODO:图表统计功能未实现
		
		Map<String,Object> groups=new HashMap();//要分组的字段
		Map<String,Object> sums=new HashMap();//要统计的字段
		
		String[][] dateFormats=new String[][]{
				null,
				new String[]{"%Y","yyyy年","Y"},
				new String[]{"%Y-%m","yyyy年MM月","M"},
				new String[]{"%Y%U","yyyy年第ww周","W"},
				new String[]{"%Y-%m-%d","yyyy年MM月dd日","D"},
				new String[]{"%Y-%m-%d %H","yyyy年MM月dd日 HH点","H"},
				new String[]{"%m","MM月"},
				new String[]{"%d","dd号"},
				new String[]{"%H","HH点"} 
		};
		
		//获取要分组的字段，放入Map中
		if(dateType>0){
			groups.put(groupKey.toString(),"DATE_FORMAT({key},'"+dateFormats[dateType][0]+"')");
		}else{
			groups.put(groupKey.toString(),"{key}");
		}
		if(dateType<6 && dateType>0){ 
			params.put("asc", groupKey.toString()); 
			if(params.get(groupKey.name()+"Start")==null){
				params.put(groupKey.name()+"Start", Utils.date(new Date(), -24, dateFormats[dateType][2]));
			}
		}
		
		
		//获取要统计的字段，放入Map中
		if(sumKey.toString().equals("count")){
			sums.put(sumKey.toString(),"count(*)");
		}else{
			sums.put(sumKey.toString(),"sum({key})");
		}
		
		List<Map> list = getIncomeRecordDao().getIncomeRecordStats(params,groups,sums);
		
		List<Map> result = new ArrayList();
		for(Map m:list){
			Map map = new HashMap();
			Object value = m.get(sumKey.toString());
			Object name = null;
			Object groupValue = m.get(groupKey.toString());
			if(dateType>0){
				name = Utils.date(Utils.parseDate(groupValue), dateFormats[dateType][1]);
			}else{
				try{
					java.lang.reflect.Method method = IncomeRecord.class.getMethod("get"+Utils.ForMat(groupKey.toString())+"$");
					method.setAccessible(true);
					name = method.invoke(IncomeRecord.fromMap(m));
				}catch(Exception ex){
					ex.printStackTrace();
				}
			}
			map.put("name", name);
			map.put("value", value);
			result.add(map);
		}
		return result;
	}
	
	
	/**
	 * 根据条件更新数据
	 * @param set
	 * @param where
	 */
	public static int updateIncomeRecord(Map set,Map where){
		if(set.isEmpty())throw new RuntimeException("set为空");
		if(where.isEmpty())throw new RuntimeException("where为空");
		where.put("confirm", "1");
		return getIncomeRecordDao().updateIncomeRecordByConfirm(set, where);
	}
	
	
	/**
	 * 根据条件更新数据
	 * @param set
	 * @param where
	 */
	public static void deleteIncomeRecord(Map where){
		if(where.isEmpty())throw new RuntimeException("where为空");
		where.put("confirm", "1");
		getIncomeRecordDao().deleteIncomeRecordByConfirm(where);
	}
	
	/**
	 * 根据条件更新数据
	 * @param set
	 * @param where
	 */
	public static void delete(Long id){
		if(id==null)throw new RuntimeException("id为空");
		
		getIncomeRecordDao().removeIncomeRecordById(id);
		
	}
	
	
	/**
	 * 保存会员收益记录对象
	 * @param params
	 * @return
	 */
	public IncomeRecord save(){
		if(this.getId()!=null)
			getIncomeRecordDao().updateIncomeRecord(this);
		else
			return getIncomeRecordDao().saveIncomeRecord(this);
		return this;
	}
	
	
	/**
	 * 更新会员收益记录对象的非空字段,注意跟Service里面的update不一样哦
	 * @param params
	 * @return
	 */
	public int update(){
		return getIncomeRecordDao().updateIncomeRecord$NotNull(this);
	}
	
	
	/**
	 * 删除
	 * @param params
	 * @return
	 */
	public void delete(){
		
		if(Utils.equals(Utils.config("logic_delete"),"true"))
			getIncomeRecordDao().removeIncomeRecordById(this.getId());
		else
		
			getIncomeRecordDao().deleteIncomeRecordById(this.getId());
	}
	
	/**
	 * 执行事务
	 * @param function
	 */
	public static <T> T execute(Function function){
		return getIncomeRecordDao().executeTransaction(function);
	}

	
	
	/*******************************编号**********************************/	
	/**
	* 编号 [非空]      
	**/
	public Long getId(){
		
		if(this.id!=null){
			return this.id;
		}
		
		return this.id;
	}
	/**
	* 获取编号格式化(toString)
	**/
	public String getId$(){
		String strValue="";
	
	
		 strValue=Utils.string(this.getId());
	 
	 	 return strValue;
	}
	/**
	* 根据编号反格式化
	**/
	public void setId$(String strValue){
		if(Utils.empty(strValue)){
			this.id=null;
			return;
		}
	
	
	 	this.id=Utils.parseLong(strValue);
	 
	}
	
	/**
	* 编号 [非空]      
	**/
	public void setId(Long id){
		this.id = id;
		
		this.setSeted(F.id);
		
	}
	
	
	
	
	
	
	
	
	
	
 	
 	
	
	
	
	
	
 	
 	
 	
	
	
	/*******************************用户身份**********************************/	
	/**
	* 用户身份    1:普通会员 2:代理 3:合伙人    
	**/
	public Short getUserType(){
		
		if(this.userType!=null){
			return this.userType;
		}
		
		return this.userType;
	}
	/**
	* 获取用户身份格式化(toString)
	**/
	public String getUserType$(){
		String strValue="";
	
	
		
			
		 if(Utils.equals(Utils.string(this.getUserType()),"1"))
			strValue=Utils.string("普通会员");		 
			
		 if(Utils.equals(Utils.string(this.getUserType()),"2"))
			strValue=Utils.string("代理");		 
			
		 if(Utils.equals(Utils.string(this.getUserType()),"3"))
			strValue=Utils.string("合伙人");		 
			
		
	 
	 	 return strValue;
	}
	/**
	* 根据用户身份反格式化
	**/
	public void setUserType$(String strValue){
		if(Utils.empty(strValue)){
			this.userType=null;
			return;
		}
	
	
		
			
		 if(Utils.equals(strValue,"普通会员"))
		 	this.userType=Utils.parseShort("1");
			
		 if(Utils.equals(strValue,"代理"))
		 	this.userType=Utils.parseShort("2");
			
		 if(Utils.equals(strValue,"合伙人"))
		 	this.userType=Utils.parseShort("3");
			
		
	 
	}
	
	/**
	* 用户身份    1:普通会员 2:代理 3:合伙人    
	**/
	public void setUserType(Short userType){
		this.userType = userType;
		
		this.setSeted(F.userType);
		
	}
	
	
	
	
	
	
	
	
	
	
 	
 	
	
	
	
	
	
 	
 	
 	
	
	
	/*******************************来源**********************************/	
	/**
	* 来源    1:直接购买 2:余额充值 3:代理卡购买 4:合伙人卡购买    
	**/
	public Short getSource(){
		
		if(this.source!=null){
			return this.source;
		}
		
		return this.source;
	}
	/**
	* 获取来源格式化(toString)
	**/
	public String getSource$(){
		String strValue="";
	
	
		
			
		 if(Utils.equals(Utils.string(this.getSource()),"1"))
			strValue=Utils.string("直接购买");		 
			
		 if(Utils.equals(Utils.string(this.getSource()),"2"))
			strValue=Utils.string("余额充值");		 
			
		 if(Utils.equals(Utils.string(this.getSource()),"3"))
			strValue=Utils.string("代理卡购买");		 
			
		 if(Utils.equals(Utils.string(this.getSource()),"4"))
			strValue=Utils.string("合伙人卡购买");		 
			
		
	 
	 	 return strValue;
	}
	/**
	* 根据来源反格式化
	**/
	public void setSource$(String strValue){
		if(Utils.empty(strValue)){
			this.source=null;
			return;
		}
	
	
		
			
		 if(Utils.equals(strValue,"直接购买"))
		 	this.source=Utils.parseShort("1");
			
		 if(Utils.equals(strValue,"余额充值"))
		 	this.source=Utils.parseShort("2");
			
		 if(Utils.equals(strValue,"代理卡购买"))
		 	this.source=Utils.parseShort("3");
			
		 if(Utils.equals(strValue,"合伙人卡购买"))
		 	this.source=Utils.parseShort("4");
			
		
	 
	}
	
	/**
	* 来源    1:直接购买 2:余额充值 3:代理卡购买 4:合伙人卡购买    
	**/
	public void setSource(Short source){
		this.source = source;
		
		this.setSeted(F.source);
		
	}
	
	
	
	
	
	
	
	
	
	
 	
 	
	
	
	
	
	
 	
 	
 	
	
	
	/*******************************收益类型**********************************/	
	/**
	* 收益类型    1:直接 2:间接    
	**/
	public Short getRevenueType(){
		
		if(this.revenueType!=null){
			return this.revenueType;
		}
		
		return this.revenueType;
	}
	/**
	* 获取收益类型格式化(toString)
	**/
	public String getRevenueType$(){
		String strValue="";
	
	
		
			
		 if(Utils.equals(Utils.string(this.getRevenueType()),"1"))
			strValue=Utils.string("直接");		 
			
		 if(Utils.equals(Utils.string(this.getRevenueType()),"2"))
			strValue=Utils.string("间接");		 
			
		
	 
	 	 return strValue;
	}
	/**
	* 根据收益类型反格式化
	**/
	public void setRevenueType$(String strValue){
		if(Utils.empty(strValue)){
			this.revenueType=null;
			return;
		}
	
	
		
			
		 if(Utils.equals(strValue,"直接"))
		 	this.revenueType=Utils.parseShort("1");
			
		 if(Utils.equals(strValue,"间接"))
		 	this.revenueType=Utils.parseShort("2");
			
		
	 
	}
	
	/**
	* 收益类型    1:直接 2:间接    
	**/
	public void setRevenueType(Short revenueType){
		this.revenueType = revenueType;
		
		this.setSeted(F.revenueType);
		
	}
	
	
	
	
	
	
	
	
	
	
 	
 	
	
	
	
	
	
 	
 	
 	
	
	
	/*******************************贡献收益**********************************/	
	/**
	* 贡献收益       
	**/
	public Double getIncome(){
		
		if(this.income!=null){
			return this.income;
		}
		
		return this.income;
	}
	/**
	* 获取贡献收益格式化(toString)
	**/
	public String getIncome$(){
		String strValue="";
	
	
			
		 strValue=Utils.string(this.getIncome());	
			
	 
	 	 return strValue;
	}
	/**
	* 根据贡献收益反格式化
	**/
	public void setIncome$(String strValue){
		if(Utils.empty(strValue)){
			this.income=null;
			return;
		}
	
	
	 	this.income=Utils.parseDouble(strValue);
	 
	}
	
	/**
	* 贡献收益       
	**/
	public void setIncome(Double income){
		this.income = income;
		
		this.setSeted(F.income);
		
	}
	
	
	
	
	
	
	
	
	
	
 	
 	
	
	
	
	
	
 	
 	
 	
	
	
	/*******************************头像**********************************/	
	/**
	* 头像       
	**/
	public String getHeadPortrait(){
		
		if(this.headPortrait!=null){
			return this.headPortrait;
		}
		
		return this.headPortrait;
	}
	/**
	* 获取头像格式化(toString)
	**/
	public String getHeadPortrait$(){
		String strValue="";
	
	
		 strValue=Utils.string(this.getHeadPortrait());
	 
	 	 return strValue;
	}
	/**
	* 根据头像反格式化
	**/
	public void setHeadPortrait$(String strValue){
		if(Utils.empty(strValue)){
			this.headPortrait=null;
			return;
		}
	
	
		this.headPortrait=strValue;
	 
	}
	
	/**
	* 头像       
	**/
	public void setHeadPortrait(String headPortrait){
		this.headPortrait = headPortrait;
		
		this.setSeted(F.headPortrait);
		
	}
	
	
	
	
	
	
	
	
	
	
 	
 	
	
	
	
	
	
 	
 	
 	
	
	
	/*******************************姓名**********************************/	
	/**
	* 姓名       
	**/
	public String getFullName(){
		
		if(this.fullName!=null){
			return this.fullName;
		}
		
		return this.fullName;
	}
	/**
	* 获取姓名格式化(toString)
	**/
	public String getFullName$(){
		String strValue="";
	
	
		 strValue=Utils.string(this.getFullName());
	 
	 	 return strValue;
	}
	/**
	* 根据姓名反格式化
	**/
	public void setFullName$(String strValue){
		if(Utils.empty(strValue)){
			this.fullName=null;
			return;
		}
	
	
	 	this.fullName=strValue;
	 
	}
	
	/**
	* 姓名       
	**/
	public void setFullName(String fullName){
		this.fullName = fullName;
		
		this.setSeted(F.fullName);
		
	}
	
	
	
	
	
	
	
	
	
	
 	
 	
	
	
	
	
	
 	
 	
 	
	
	
	/*******************************贡献人名称**********************************/	
	/**
	* 贡献人名称       
	**/
	public String getIncomersName(){
		
		if(this.incomersName!=null){
			return this.incomersName;
		}
		
		return this.incomersName;
	}
	/**
	* 获取贡献人名称格式化(toString)
	**/
	public String getIncomersName$(){
		String strValue="";
	
	
		 strValue=Utils.string(this.getIncomersName());
	 
	 	 return strValue;
	}
	/**
	* 根据贡献人名称反格式化
	**/
	public void setIncomersName$(String strValue){
		if(Utils.empty(strValue)){
			this.incomersName=null;
			return;
		}
	
	
	 	this.incomersName=strValue;
	 
	}
	
	/**
	* 贡献人名称       
	**/
	public void setIncomersName(String incomersName){
		this.incomersName = incomersName;
		
		this.setSeted(F.incomersName);
		
	}
	
	
	
	
	
	
	
	
	
	
 	
 	
	
	
	
	
	
 	
 	
 	
	
	
	/*******************************收益人姓名**********************************/	
	/**
	* 收益人姓名       
	**/
	public String getIncomerName(){
		
		if(this.incomerName!=null){
			return this.incomerName;
		}
		
		return this.incomerName;
	}
	/**
	* 获取收益人姓名格式化(toString)
	**/
	public String getIncomerName$(){
		String strValue="";
	
	
		 strValue=Utils.string(this.getIncomerName());
	 
	 	 return strValue;
	}
	/**
	* 根据收益人姓名反格式化
	**/
	public void setIncomerName$(String strValue){
		if(Utils.empty(strValue)){
			this.incomerName=null;
			return;
		}
	
	
	 	this.incomerName=strValue;
	 
	}
	
	/**
	* 收益人姓名       
	**/
	public void setIncomerName(String incomerName){
		this.incomerName = incomerName;
		
		this.setSeted(F.incomerName);
		
	}
	
	
	
	
	
	
	
	
	
	
 	
 	
	
	
	
	
	
 	
 	
 	
	
	
	/*******************************贡献人**********************************/	
	/**
	* 贡献人  [Member]     
	**/
	public Long getContributor(){
		
		if(this.contributor!=null){
			return this.contributor;
		}
		
		return this.contributor;
	}
	/**
	* 获取贡献人格式化(toString)
	**/
	public String getContributor$(){
		String strValue="";
	
	
		 
		if(this.getContributor()!=null){
			
				strValue+=Utils.string(Member.getKeyValue(this.getContributor()));
			
		}			
		 
	 
	 	 return strValue;
	}
	/**
	* 根据贡献人反格式化
	**/
	public void setContributor$(String strValue){
		if(Utils.empty(strValue)){
			this.contributor=null;
			return;
		}
	
	
		 
		Member item = Member.find(strValue);
		if(item!=null){
			
			this.contributor = Utils.parseLong(item.getUid());
			
		}
		 
	 
	}
	
	/**
	* 贡献人  [Member]     
	**/
	public void setContributor(Long contributor){
		this.contributor = contributor;
		
		this.setSeted(F.contributor);
		
	}
	
	
		 
	
	
	
	
	
	
	
	
	
 	
 	
	
	
	
	
	
 	
 		
	/**
	* 获取关联对象[会员信息]
	**/	 			
 	public Member get$contributor(){
 		if(this.$contributor!=null)
 			return this.$contributor;
 		com.distribute.framework.model.Member member = null;
		if(this.getContributor()!=null){
		
 			member = Member.get(this.getContributor());
 		
 		}
 		return member;
	}
	
 	
	
	
	/*******************************收益人**********************************/	
	/**
	* 收益人  [Member]     
	**/
	public Long getBeneficiary(){
		
		if(this.beneficiary!=null){
			return this.beneficiary;
		}
		
		return this.beneficiary;
	}
	/**
	* 获取收益人格式化(toString)
	**/
	public String getBeneficiary$(){
		String strValue="";
	
	
		 
		if(this.getBeneficiary()!=null){
			
				strValue+=Utils.string(Member.getKeyValue(this.getBeneficiary()));
			
		}			
		 
	 
	 	 return strValue;
	}
	/**
	* 根据收益人反格式化
	**/
	public void setBeneficiary$(String strValue){
		if(Utils.empty(strValue)){
			this.beneficiary=null;
			return;
		}
	
	
		 
		Member item = Member.find(strValue);
		if(item!=null){
			
			this.beneficiary = Utils.parseLong(item.getUid());
			
		}
		 
	 
	}
	
	/**
	* 收益人  [Member]     
	**/
	public void setBeneficiary(Long beneficiary){
		this.beneficiary = beneficiary;
		
		this.setSeted(F.beneficiary);
		
	}
	
	
		 
	
	
	
	
	
	
	
	
	
 	
 	
	
	
	
	
	
 	
 		
	/**
	* 获取关联对象[会员信息]
	**/	 			
 	public Member get$beneficiary(){
 		if(this.$beneficiary!=null)
 			return this.$beneficiary;
 		com.distribute.framework.model.Member member = null;
		if(this.getBeneficiary()!=null){
		
 			member = Member.get(this.getBeneficiary());
 		
 		}
 		return member;
	}
	
 	
	
	
	/*******************************订单编号**********************************/	
	/**
	* 订单编号       
	**/
	public String getOrderNumber(){
		
		if(this.orderNumber!=null){
			return this.orderNumber;
		}
		
		return this.orderNumber;
	}
	/**
	* 获取订单编号格式化(toString)
	**/
	public String getOrderNumber$(){
		String strValue="";
	
	
		 strValue=Utils.string(this.getOrderNumber());
	 
	 	 return strValue;
	}
	/**
	* 根据订单编号反格式化
	**/
	public void setOrderNumber$(String strValue){
		if(Utils.empty(strValue)){
			this.orderNumber=null;
			return;
		}
	
	
	 	this.orderNumber=strValue;
	 
	}
	
	/**
	* 订单编号       
	**/
	public void setOrderNumber(String orderNumber){
		this.orderNumber = orderNumber;
		
		this.setSeted(F.orderNumber);
		
	}
	
	
	
	
	
	
	
	
	
	
 	
 	
	
	
	
	
	
 	
 	
 	
	
	
	/*******************************品牌信息**********************************/	
	/**
	* 品牌信息  [Merchant]     
	**/
	public Long getBrands(){
		
		if(this.brands!=null){
			return this.brands;
		}
		
		return this.brands;
	}
	/**
	* 获取品牌信息格式化(toString)
	**/
	public String getBrands$(){
		String strValue="";
	
	
		 
		if(this.getBrands()!=null){
			
				strValue+=Utils.string(Merchant.getKeyValue(this.getBrands()));
			
		}			
		 
	 
	 	 return strValue;
	}
	/**
	* 根据品牌信息反格式化
	**/
	public void setBrands$(String strValue){
		if(Utils.empty(strValue)){
			this.brands=null;
			return;
		}
	
	
		 
		Merchant item = Merchant.find(strValue);
		if(item!=null){
			
			this.brands = Utils.parseLong(item.getId());
			
		}
		 
	 
	}
	
	/**
	* 品牌信息  [Merchant]     
	**/
	public void setBrands(Long brands){
		this.brands = brands;
		
		this.setSeted(F.brands);
		
	}
	
	
		 
	
	
	
	
	
	
	
	
	
 	
 	
	
	
	
	
	
 	
 		
	/**
	* 获取关联对象[品牌信息]
	**/	 			
 	public Merchant get$brands(){
 		if(this.$brands!=null)
 			return this.$brands;
 		com.distribute.framework.model.Merchant merchant = null;
		if(this.getBrands()!=null){
		
 			merchant = Merchant.get(this.getBrands());
 		
 		}
 		return merchant;
	}
	
 	
	
	
	/*******************************结算情况**********************************/	
	/**
	* 结算情况    1:待结算 2:已结算    
	**/
	public Short getEndStatus(){
		
		if(this.endStatus!=null){
			return this.endStatus;
		}
		
		return this.endStatus;
	}
	/**
	* 获取结算情况格式化(toString)
	**/
	public String getEndStatus$(){
		String strValue="";
	
	
		
			
		 if(Utils.equals(Utils.string(this.getEndStatus()),"1"))
			strValue=Utils.string("待结算");		 
			
		 if(Utils.equals(Utils.string(this.getEndStatus()),"2"))
			strValue=Utils.string("已结算");		 
			
		
	 
	 	 return strValue;
	}
	/**
	* 根据结算情况反格式化
	**/
	public void setEndStatus$(String strValue){
		if(Utils.empty(strValue)){
			this.endStatus=null;
			return;
		}
	
	
		
			
		 if(Utils.equals(strValue,"待结算"))
		 	this.endStatus=Utils.parseShort("1");
			
		 if(Utils.equals(strValue,"已结算"))
		 	this.endStatus=Utils.parseShort("2");
			
		
	 
	}
	
	/**
	* 结算情况    1:待结算 2:已结算    
	**/
	public void setEndStatus(Short endStatus){
		this.endStatus = endStatus;
		
		this.setSeted(F.endStatus);
		
	}
	
	
	
	
	
	
	
	
	
	
 	
 	
	
	
	
	
	
 	
 	
 	
	
	
	/*******************************修改时间**********************************/	
	/**
	* 修改时间 [非空]      
	**/
	public Date getUpdateTime(){
		
		if(this.updateTime!=null){
			return this.updateTime;
		}
		
		return this.updateTime;
	}
	/**
	* 获取修改时间格式化(toString)
	**/
	public String getUpdateTime$(){
		String strValue="";
	
	
	 	
		 strValue=Utils.string(Utils.date(this.getUpdateTime(),"yyyy-MM-dd HH:mm:ss"));
		
	 
	 	 return strValue;
	}
	/**
	* 根据修改时间反格式化
	**/
	public void setUpdateTime$(String strValue){
		if(Utils.empty(strValue)){
			this.updateTime=null;
			return;
		}
	
	
	 	this.updateTime=Utils.date(strValue,"yyyy-MM-dd HH:mm:ss");
	 
	}
	
	/**
	* 修改时间 [非空]      
	**/
	public void setUpdateTime(Date updateTime){
		this.updateTime = updateTime;
		
		this.setSeted(F.updateTime);
		
	}
	
	
	
	
	
	
	
	
	
	
 	
 	
	
	
	
	
	
 	
 	
 	
	
	
	/*******************************添加时间**********************************/	
	/**
	* 添加时间 [非空]      
	**/
	public Date getAddTime(){
		
		if(this.addTime!=null){
			return this.addTime;
		}
		
		return this.addTime;
	}
	/**
	* 获取添加时间格式化(toString)
	**/
	public String getAddTime$(){
		String strValue="";
	
	
	 	
		 strValue=Utils.string(Utils.date(this.getAddTime(),"yyyy-MM-dd HH:mm:ss"));
		
	 
	 	 return strValue;
	}
	/**
	* 根据添加时间反格式化
	**/
	public void setAddTime$(String strValue){
		if(Utils.empty(strValue)){
			this.addTime=null;
			return;
		}
	
	
	 	this.addTime=Utils.date(strValue,"yyyy-MM-dd HH:mm:ss");
	 
	}
	
	/**
	* 添加时间 [非空]      
	**/
	public void setAddTime(Date addTime){
		this.addTime = addTime;
		
		this.setSeted(F.addTime);
		
	}
	
	
	
	
	
	
	
	
	
	
 	
 	
	
	
	
	
	
 	
 	
 	
	
	
	/*******************************状态**********************************/	
	/**
	* 状态 [非空]   1:正常 0:无效    
	**/
	public Short getStatus(){
		
		if(this.status!=null){
			return this.status;
		}
		
		return this.status;
	}
	/**
	* 获取状态格式化(toString)
	**/
	public String getStatus$(){
		String strValue="";
	
	
		
			
		 if(Utils.equals(Utils.string(this.getStatus()),"1"))
			strValue=Utils.string("正常");		 
			
		 if(Utils.equals(Utils.string(this.getStatus()),"0"))
			strValue=Utils.string("无效");		 
			
		
	 
	 	 return strValue;
	}
	/**
	* 根据状态反格式化
	**/
	public void setStatus$(String strValue){
		if(Utils.empty(strValue)){
			this.status=null;
			return;
		}
	
	
		
			
		 if(Utils.equals(strValue,"正常"))
		 	this.status=Utils.parseShort("1");
			
		 if(Utils.equals(strValue,"无效"))
		 	this.status=Utils.parseShort("0");
			
		
	 
	}
	
	/**
	* 状态 [非空]   1:正常 0:无效    
	**/
	public void setStatus(Short status){
		this.status = status;
		
		this.setSeted(F.status);
		
	}
	
	
	
	
	
	
	
	
	
	
 	
 	
	
	
	
	
	
 	
 	
 	
	
	
	
	/************LAZY3Q_DEFINE_CODE************/
	/************LAZY3Q_DEFINE_CODE************/	
	
	
	/**
	 * 触发器
	 */
	public static void on(Trigger.Index index,final Notify.Listener listener,Trigger.Type... types){
		Notify.on(IncomeRecord.class, index, listener, types);
	}
	public static void on(final Notify.Listener listener,String type){
		Notify.on(IncomeRecord.class, listener, type);
	}
	/**
	 * 当修改字段时
	 * @param filedName
	 * @param listener
	 */
	public static void on(String filedName,final Notify.Listener listener){
		Notify.on(IncomeRecord.class, listener, filedName);
	}
	/**
	 * 当修改字段为某值时
	 * @param filedName
	 * @param value
	 * @param listener
	 */
	public static void on(String filedName,Object value,final Notify.Listener listener){
		if(value==null)return;
		Notify.on(IncomeRecord.class, listener, filedName+"."+Utils.md5(""+value));
	}
	public void notify(String type){
		Trigger.on(IncomeRecord.class,type, this);
	}
	
	
	/**
	 * 用来获取当有字段关联对象时的获取方式,调用如${IncomeRecord.obj.filedName}
	 * 因为有些变态的模板语言不能识别$，所以不能以${IncomeRecord.$filedName}获取关联对象
	 */
	public Map getObj(){
		return new HashMap(){
			@Override
			public Object get(Object key) {
				try {
					return IncomeRecord.class.getMethod("get$"+Utils.forMat(key.toString())).invoke(IncomeRecord.this);
				} catch (Exception e) {
					e.printStackTrace();
				}
				return null;
			}
		};
	}
	/**
	 * 用来获取某字段格式化的获取方式,调用如${IncomeRecord.fmt.filedName}
	 * 因为有些变态的模板语言不能识别$，所以不能以${IncomeRecord.filedName$}获取某字段格式化
	 */
	public Map getFmt(){
		return new HashMap(){
			@Override
			public Object get(Object key) {
				try {
					return IncomeRecord.class.getMethod("get"+Utils.ForMat(key.toString()+"$")).invoke(IncomeRecord.this);
				} catch (Exception e) {
					e.printStackTrace();
				}
				return null;
			}
		};
	}
	/**
	 * 获取查询参数链式串
	 * @return
	 */
	public static @Deprecated M where(){ return new M(0); }
	public static @Deprecated M m(){ return new M(0); }
	public static M where = new M(0,true);
	public static @database(DatabaseNames.distribute_sys) class M extends IbatisMap{
		int type = 0; 
		M linked = null;
		Boolean proxy = false;
		public M set = null;
		public M(int type){
			this.type = type;
			if(this.type==0){
				set = new M(1,true);
				set.linked = this;
			}
		};
		public M(int type,Boolean proxy){
			this.type = type;
			this.proxy=proxy;
		};
		public M proxy(){
			M m = new M(this.type);//当前的对像
			if(this.type==0){
				m.set = new M(1,true);//set对象
				m.set.linked = m;
			}else{
				m.linked=this.linked;
				this.linked.linked=m;
			}
			return m;
		}
		public @Deprecated M set(){			
			M m = this;
			m.linked=new M(1);
			m.linked.linked=m;
			return m.linked;
		};
		
		public M on(IbatisMap value,C column,String joinColumn){if(proxy)return proxy().on(value,column,joinColumn);this.put(value.getClass().getDeclaringClass().getSimpleName(), value);value.put("on", column.toString());value.put("to", joinColumn);return this;};
		
		
			
		
		/** 编号 [非空]       **/
		public M id(Object id){if(proxy)return proxy().id(id);  this.put("id", id);return this;};
	 	/** and id is null */
 		public M idNull(){if(proxy)return proxy().idNull();if(this.get("idNot")==null)this.put("idNot", "");this.put("id", null);return this;};
 		/** not .... */
 		public M idNot(){if(proxy)return proxy().idNot();this.put("idNot", "not");return this;};
 		public M idNotNull(){if(proxy)return proxy().idNotNull();this.put("idNot", "not");this.put("id", null);return this;};
 		public M idNot(Object id){if(proxy)return proxy().idNot(id);this.put("idNot", "not");this.put("id", id);return this;};
	 		
		/** and id <= ? */
		public M idMin(Object min){if(proxy)return proxy().idMin(min);this.put("idMin", min);return this;};
		/** and id >= ? */
		public M idMax(Object max){if(proxy)return proxy().idMax(max);this.put("idMax", max);return this;};
			
			
		public M idIn(String ids){
			if(proxy)return proxy().idIn(ids);  this.put("idIn", ids);return this;
		};	
 			
		
			
	 	
			
		
		/** 用户身份    1:普通会员 2:代理 3:合伙人     **/
		public M userType(Object userType){if(proxy)return proxy().userType(userType);  this.put("userType", userType);return this;};
	 	/** and user_type is null */
 		public M userTypeNull(){if(proxy)return proxy().userTypeNull();if(this.get("userTypeNot")==null)this.put("userTypeNot", "");this.put("userType", null);return this;};
 		/** not .... */
 		public M userTypeNot(){if(proxy)return proxy().userTypeNot();this.put("userTypeNot", "not");return this;};
 		public M userTypeNotNull(){if(proxy)return proxy().userTypeNotNull();this.put("userTypeNot", "not");this.put("userType", null);return this;};
 		public M userTypeNot(Object userType){if(proxy)return proxy().userTypeNot(userType);this.put("userTypeNot", "not");this.put("userType", userType);return this;};
	 		
			
		public M userTypeIn(String ids){
			if(proxy)return proxy().userTypeIn(ids);  this.put("userTypeIn", ids);return this;
		};	
 			
		
			
	 	
			
		
		/** 来源    1:直接购买 2:余额充值 3:代理卡购买 4:合伙人卡购买     **/
		public M source(Object source){if(proxy)return proxy().source(source);  this.put("source", source);return this;};
	 	/** and source is null */
 		public M sourceNull(){if(proxy)return proxy().sourceNull();if(this.get("sourceNot")==null)this.put("sourceNot", "");this.put("source", null);return this;};
 		/** not .... */
 		public M sourceNot(){if(proxy)return proxy().sourceNot();this.put("sourceNot", "not");return this;};
 		public M sourceNotNull(){if(proxy)return proxy().sourceNotNull();this.put("sourceNot", "not");this.put("source", null);return this;};
 		public M sourceNot(Object source){if(proxy)return proxy().sourceNot(source);this.put("sourceNot", "not");this.put("source", source);return this;};
	 		
			
		public M sourceIn(String ids){
			if(proxy)return proxy().sourceIn(ids);  this.put("sourceIn", ids);return this;
		};	
 			
		
			
	 	
			
		
		/** 收益类型    1:直接 2:间接     **/
		public M revenueType(Object revenueType){if(proxy)return proxy().revenueType(revenueType);  this.put("revenueType", revenueType);return this;};
	 	/** and revenue_type is null */
 		public M revenueTypeNull(){if(proxy)return proxy().revenueTypeNull();if(this.get("revenueTypeNot")==null)this.put("revenueTypeNot", "");this.put("revenueType", null);return this;};
 		/** not .... */
 		public M revenueTypeNot(){if(proxy)return proxy().revenueTypeNot();this.put("revenueTypeNot", "not");return this;};
 		public M revenueTypeNotNull(){if(proxy)return proxy().revenueTypeNotNull();this.put("revenueTypeNot", "not");this.put("revenueType", null);return this;};
 		public M revenueTypeNot(Object revenueType){if(proxy)return proxy().revenueTypeNot(revenueType);this.put("revenueTypeNot", "not");this.put("revenueType", revenueType);return this;};
	 		
			
		public M revenueTypeIn(String ids){
			if(proxy)return proxy().revenueTypeIn(ids);  this.put("revenueTypeIn", ids);return this;
		};	
 			
		
			
	 	
			
		
		/** 贡献收益        **/
		public M income(Object income){if(proxy)return proxy().income(income);  this.put("income", income);return this;};
	 	/** and income is null */
 		public M incomeNull(){if(proxy)return proxy().incomeNull();if(this.get("incomeNot")==null)this.put("incomeNot", "");this.put("income", null);return this;};
 		/** not .... */
 		public M incomeNot(){if(proxy)return proxy().incomeNot();this.put("incomeNot", "not");return this;};
 		public M incomeNotNull(){if(proxy)return proxy().incomeNotNull();this.put("incomeNot", "not");this.put("income", null);return this;};
 		public M incomeNot(Object income){if(proxy)return proxy().incomeNot(income);this.put("incomeNot", "not");this.put("income", income);return this;};
	 		
		/** and income <= ? */
		public M incomeMin(Object min){if(proxy)return proxy().incomeMin(min);this.put("incomeMin", min);return this;};
		/** and income >= ? */
		public M incomeMax(Object max){if(proxy)return proxy().incomeMax(max);this.put("incomeMax", max);return this;};
			
			
		
			
	 	
			
		
		/** 头像        **/
		public M headPortrait(Object headPortrait){if(proxy)return proxy().headPortrait(headPortrait);  this.put("headPortrait", headPortrait);return this;};
	 	/** and head_portrait is null */
 		public M headPortraitNull(){if(proxy)return proxy().headPortraitNull();if(this.get("headPortraitNot")==null)this.put("headPortraitNot", "");this.put("headPortrait", null);return this;};
 		/** not .... */
 		public M headPortraitNot(){if(proxy)return proxy().headPortraitNot();this.put("headPortraitNot", "not");return this;};
 		public M headPortraitNotNull(){if(proxy)return proxy().headPortraitNotNull();this.put("headPortraitNot", "not");this.put("headPortrait", null);return this;};
 		public M headPortraitNot(Object headPortrait){if(proxy)return proxy().headPortraitNot(headPortrait);this.put("headPortraitNot", "not");this.put("headPortrait", headPortrait);return this;};
	 		
			
		
			
	 	
			
		
		/** 姓名        **/
		public M fullName(Object fullName){if(proxy)return proxy().fullName(fullName);  this.put("fullName", fullName);return this;};
	 	/** and full_name is null */
 		public M fullNameNull(){if(proxy)return proxy().fullNameNull();if(this.get("fullNameNot")==null)this.put("fullNameNot", "");this.put("fullName", null);return this;};
 		/** not .... */
 		public M fullNameNot(){if(proxy)return proxy().fullNameNot();this.put("fullNameNot", "not");return this;};
 		public M fullNameNotNull(){if(proxy)return proxy().fullNameNotNull();this.put("fullNameNot", "not");this.put("fullName", null);return this;};
 		public M fullNameNot(Object fullName){if(proxy)return proxy().fullNameNot(fullName);this.put("fullNameNot", "not");this.put("fullName", fullName);return this;};
	 		
			
		
			
	 	
			
		
		/** 贡献人名称        **/
		public M incomersName(Object incomersName){if(proxy)return proxy().incomersName(incomersName);  this.put("incomersName", incomersName);return this;};
	 	/** and incomers_name is null */
 		public M incomersNameNull(){if(proxy)return proxy().incomersNameNull();if(this.get("incomersNameNot")==null)this.put("incomersNameNot", "");this.put("incomersName", null);return this;};
 		/** not .... */
 		public M incomersNameNot(){if(proxy)return proxy().incomersNameNot();this.put("incomersNameNot", "not");return this;};
 		public M incomersNameNotNull(){if(proxy)return proxy().incomersNameNotNull();this.put("incomersNameNot", "not");this.put("incomersName", null);return this;};
 		public M incomersNameNot(Object incomersName){if(proxy)return proxy().incomersNameNot(incomersName);this.put("incomersNameNot", "not");this.put("incomersName", incomersName);return this;};
	 		
			
		
			
	 	
			
		
		/** 收益人姓名        **/
		public M incomerName(Object incomerName){if(proxy)return proxy().incomerName(incomerName);  this.put("incomerName", incomerName);return this;};
	 	/** and incomer_name is null */
 		public M incomerNameNull(){if(proxy)return proxy().incomerNameNull();if(this.get("incomerNameNot")==null)this.put("incomerNameNot", "");this.put("incomerName", null);return this;};
 		/** not .... */
 		public M incomerNameNot(){if(proxy)return proxy().incomerNameNot();this.put("incomerNameNot", "not");return this;};
 		public M incomerNameNotNull(){if(proxy)return proxy().incomerNameNotNull();this.put("incomerNameNot", "not");this.put("incomerName", null);return this;};
 		public M incomerNameNot(Object incomerName){if(proxy)return proxy().incomerNameNot(incomerName);this.put("incomerNameNot", "not");this.put("incomerName", incomerName);return this;};
	 		
			
		
			
	 	
			
		public M contributor$on(Member.M value){if(proxy)return proxy().contributor$on(value);this.put("Contributor", value);value.put("on", "contributor");return this;};
 				
 			
		
		/** 贡献人  [Member]      **/
		public M contributor(Object contributor){if(proxy)return proxy().contributor(contributor);  this.put("contributor", contributor);return this;};
	 	/** and contributor is null */
 		public M contributorNull(){if(proxy)return proxy().contributorNull();if(this.get("contributorNot")==null)this.put("contributorNot", "");this.put("contributor", null);return this;};
 		/** not .... */
 		public M contributorNot(){if(proxy)return proxy().contributorNot();this.put("contributorNot", "not");return this;};
 		public M contributorNotNull(){if(proxy)return proxy().contributorNotNull();this.put("contributorNot", "not");this.put("contributor", null);return this;};
 		public M contributorNot(Object contributor){if(proxy)return proxy().contributorNot(contributor);this.put("contributorNot", "not");this.put("contributor", contributor);return this;};
	 		
			
		public M contributorIn(String ids){
			if(proxy)return proxy().contributorIn(ids);  this.put("contributorIn", ids);return this;
		};	
 			
		
			
	 	
			
		public M beneficiary$on(Member.M value){if(proxy)return proxy().beneficiary$on(value);this.put("Beneficiary", value);value.put("on", "beneficiary");return this;};
 				
 			
		
		/** 收益人  [Member]      **/
		public M beneficiary(Object beneficiary){if(proxy)return proxy().beneficiary(beneficiary);  this.put("beneficiary", beneficiary);return this;};
	 	/** and beneficiary is null */
 		public M beneficiaryNull(){if(proxy)return proxy().beneficiaryNull();if(this.get("beneficiaryNot")==null)this.put("beneficiaryNot", "");this.put("beneficiary", null);return this;};
 		/** not .... */
 		public M beneficiaryNot(){if(proxy)return proxy().beneficiaryNot();this.put("beneficiaryNot", "not");return this;};
 		public M beneficiaryNotNull(){if(proxy)return proxy().beneficiaryNotNull();this.put("beneficiaryNot", "not");this.put("beneficiary", null);return this;};
 		public M beneficiaryNot(Object beneficiary){if(proxy)return proxy().beneficiaryNot(beneficiary);this.put("beneficiaryNot", "not");this.put("beneficiary", beneficiary);return this;};
	 		
			
		public M beneficiaryIn(String ids){
			if(proxy)return proxy().beneficiaryIn(ids);  this.put("beneficiaryIn", ids);return this;
		};	
 			
		
			
	 	
			
		
		/** 订单编号        **/
		public M orderNumber(Object orderNumber){if(proxy)return proxy().orderNumber(orderNumber);  this.put("orderNumber", orderNumber);return this;};
	 	/** and order_number is null */
 		public M orderNumberNull(){if(proxy)return proxy().orderNumberNull();if(this.get("orderNumberNot")==null)this.put("orderNumberNot", "");this.put("orderNumber", null);return this;};
 		/** not .... */
 		public M orderNumberNot(){if(proxy)return proxy().orderNumberNot();this.put("orderNumberNot", "not");return this;};
 		public M orderNumberNotNull(){if(proxy)return proxy().orderNumberNotNull();this.put("orderNumberNot", "not");this.put("orderNumber", null);return this;};
 		public M orderNumberNot(Object orderNumber){if(proxy)return proxy().orderNumberNot(orderNumber);this.put("orderNumberNot", "not");this.put("orderNumber", orderNumber);return this;};
	 		
			
		
			
	 	
			
		public M brands$on(Merchant.M value){if(proxy)return proxy().brands$on(value);this.put("Brands", value);value.put("on", "brands");return this;};
 				
 			
		
		/** 品牌信息  [Merchant]      **/
		public M brands(Object brands){if(proxy)return proxy().brands(brands);  this.put("brands", brands);return this;};
	 	/** and brands is null */
 		public M brandsNull(){if(proxy)return proxy().brandsNull();if(this.get("brandsNot")==null)this.put("brandsNot", "");this.put("brands", null);return this;};
 		/** not .... */
 		public M brandsNot(){if(proxy)return proxy().brandsNot();this.put("brandsNot", "not");return this;};
 		public M brandsNotNull(){if(proxy)return proxy().brandsNotNull();this.put("brandsNot", "not");this.put("brands", null);return this;};
 		public M brandsNot(Object brands){if(proxy)return proxy().brandsNot(brands);this.put("brandsNot", "not");this.put("brands", brands);return this;};
	 		
			
		public M brandsIn(String ids){
			if(proxy)return proxy().brandsIn(ids);  this.put("brandsIn", ids);return this;
		};	
 			
		
			
	 	
			
		
		/** 结算情况    1:待结算 2:已结算     **/
		public M endStatus(Object endStatus){if(proxy)return proxy().endStatus(endStatus);  this.put("endStatus", endStatus);return this;};
	 	/** and end_status is null */
 		public M endStatusNull(){if(proxy)return proxy().endStatusNull();if(this.get("endStatusNot")==null)this.put("endStatusNot", "");this.put("endStatus", null);return this;};
 		/** not .... */
 		public M endStatusNot(){if(proxy)return proxy().endStatusNot();this.put("endStatusNot", "not");return this;};
 		public M endStatusNotNull(){if(proxy)return proxy().endStatusNotNull();this.put("endStatusNot", "not");this.put("endStatus", null);return this;};
 		public M endStatusNot(Object endStatus){if(proxy)return proxy().endStatusNot(endStatus);this.put("endStatusNot", "not");this.put("endStatus", endStatus);return this;};
	 		
			
		public M endStatusIn(String ids){
			if(proxy)return proxy().endStatusIn(ids);  this.put("endStatusIn", ids);return this;
		};	
 			
		
			
	 	
			
		
		/** 修改时间 [非空]       **/
		public M updateTime(Object updateTime){if(proxy)return proxy().updateTime(updateTime);  this.put("updateTime", updateTime);return this;};
	 	/** and update_time is null */
 		public M updateTimeNull(){if(proxy)return proxy().updateTimeNull();if(this.get("updateTimeNot")==null)this.put("updateTimeNot", "");this.put("updateTime", null);return this;};
 		/** not .... */
 		public M updateTimeNot(){if(proxy)return proxy().updateTimeNot();this.put("updateTimeNot", "not");return this;};
 		public M updateTimeNotNull(){if(proxy)return proxy().updateTimeNotNull();this.put("updateTimeNot", "not");this.put("updateTime", null);return this;};
 		public M updateTimeNot(Object updateTime){if(proxy)return proxy().updateTimeNot(updateTime);this.put("updateTimeNot", "not");this.put("updateTime", updateTime);return this;};
	 		
 		/** and update_time >= ? */
 		public M updateTimeStart(Object start){if(proxy)return proxy().updateTimeStart(start);this.put("updateTimeStart", start);return this;};			
 		/** and update_time <= ? */
 		public M updateTimeEnd(Object end){if(proxy)return proxy().updateTimeEnd(end);this.put("updateTimeEnd", end);return this;};
			
			
		
			
	 	
			
		
		/** 添加时间 [非空]       **/
		public M addTime(Object addTime){if(proxy)return proxy().addTime(addTime);  this.put("addTime", addTime);return this;};
	 	/** and add_time is null */
 		public M addTimeNull(){if(proxy)return proxy().addTimeNull();if(this.get("addTimeNot")==null)this.put("addTimeNot", "");this.put("addTime", null);return this;};
 		/** not .... */
 		public M addTimeNot(){if(proxy)return proxy().addTimeNot();this.put("addTimeNot", "not");return this;};
 		public M addTimeNotNull(){if(proxy)return proxy().addTimeNotNull();this.put("addTimeNot", "not");this.put("addTime", null);return this;};
 		public M addTimeNot(Object addTime){if(proxy)return proxy().addTimeNot(addTime);this.put("addTimeNot", "not");this.put("addTime", addTime);return this;};
	 		
 		/** and add_time >= ? */
 		public M addTimeStart(Object start){if(proxy)return proxy().addTimeStart(start);this.put("addTimeStart", start);return this;};			
 		/** and add_time <= ? */
 		public M addTimeEnd(Object end){if(proxy)return proxy().addTimeEnd(end);this.put("addTimeEnd", end);return this;};
			
			
		
			
	 	
			
		
		/** 状态 [非空]   1:正常 0:无效     **/
		public M status(Object status){if(proxy)return proxy().status(status);  this.put("status", status);return this;};
	 	/** and status is null */
 		public M statusNull(){if(proxy)return proxy().statusNull();if(this.get("statusNot")==null)this.put("statusNot", "");this.put("status", null);return this;};
 		/** not .... */
 		public M statusNot(){if(proxy)return proxy().statusNot();this.put("statusNot", "not");return this;};
 		public M statusNotNull(){if(proxy)return proxy().statusNotNull();this.put("statusNot", "not");this.put("status", null);return this;};
 		public M statusNot(Object status){if(proxy)return proxy().statusNot(status);this.put("statusNot", "not");this.put("status", status);return this;};
	 		
			
		public M statusIn(String ids){
			if(proxy)return proxy().statusIn(ids);  this.put("statusIn", ids);return this;
		};	
 			
		
			
	 	
	 	public M add(String key, Object value) {if(proxy)return proxy().add(key,value);this.put(key, value);return this;}
	 	public M add(F key, Object value) {if(proxy)return proxy().add(key,value);this.put(key.toString(), value);return this;}
	 	
	 	public M desc(C key) {if(proxy)return proxy().desc(key);this.put("desc", key.column);return this;}
	 	public M asc(C key) {if(proxy)return proxy().asc(key);this.put("asc", key.column);return this;}
	 	public M desc(String sql) {if(proxy)return proxy().desc(sql);this.put("desc", sql);return this;}
	 	public M asc(String sql) {if(proxy)return proxy().asc(sql);this.put("asc", sql);return this;}
	 	public M definex(String sql) {if(proxy)return proxy().definex(sql);this.put("definex", sql);return this;}
	 	
	 	/** 获取所有会员收益记录 **/
		public @api List<IncomeRecord> list(Integer size){			
			return getIncomeRecordList(this,size);
		}
		/** 获取会员收益记录分页 **/
		public @api Page<IncomeRecord> page(Integer page,Integer size){			
			return getIncomeRecordPage(page, size , this);
		}
		/** 根据查询条件取会员收益记录 **/
		public @api IncomeRecord get(){			
			return getIncomeRecord(this);
		}
		/** 获取会员收益记录数 **/
		public @api Long count(){			
			return getIncomeRecordCount(this);
		}
		/** 获取会员收益记录表达式 **/
		public @api <T> T eval(String strEval){			
			return getIncomeRecordEval(strEval,this);
		}
		
		/** 获取会员收益记录统计 **/
		public @api List<Map> stats(C sumKey,C groupKey,int dateType){			
			return getIncomeRecordStats(this,sumKey,groupKey,dateType);
		}
		/** 获取会员收益记录统计 **/
		public @api List<Map> stats(C sumKey,C groupKey){			
			return getIncomeRecordStats(this,sumKey,groupKey,-1);
		}
		
		/** 根据条件更新 **/
		public @api int update(){			
			M where = null;
			M set = null;
			if(this.type==0){
				if(this.linked==null)throw new RuntimeException("未发set");
				where = this;
				set = this.linked;
			}else{
				if(this.linked==null)throw new RuntimeException("未发where条件");
				set = this;
				where = this.linked;
			}
			return updateIncomeRecord(set,where);
		}
		/** 根据条件删除 **/
		public @api void delete(){			
			deleteIncomeRecord(this);
		}
	}
	
	public static class Param extends M{
		public Param(int type) {
			super(type);
		}
		public Param(int type, Boolean proxy) {
			super(type, proxy);
		}
	}
	
	/** 对象的字段描述 **/
	public static class F{
		
			
		/** 编号 [非空]       **/
		public final static @type(Long.class)  String id="id";
	 			
			
	 	
			
		/** 用户身份    1:普通会员 2:代理 3:合伙人     **/
		public final static @type(Short.class)  String userType="userType";
	 			
			
	 	
			
		/** 来源    1:直接购买 2:余额充值 3:代理卡购买 4:合伙人卡购买     **/
		public final static @type(Short.class)  String source="source";
	 			
			
	 	
			
		/** 收益类型    1:直接 2:间接     **/
		public final static @type(Short.class)  String revenueType="revenueType";
	 			
			
	 	
			
		/** 贡献收益        **/
		public final static @type(Double.class)  String income="income";
	 			
		/** and income >= ? */
		public final static @type(Double.class) String incomeMin="incomeMin";
		/** and income <= ? */
		public final static @type(Double.class) String incomeMax="incomeMax";
				
			
	 	
			
		/** 头像        **/
		public final static @type(String.class) @like String headPortrait="headPortrait";
	 			
			
	 	
			
		/** 姓名        **/
		public final static @type(String.class)  String fullName="fullName";
	 			
			
	 	
			
		/** 贡献人名称        **/
		public final static @type(String.class) @like String incomersName="incomersName";
	 			
			
	 	
			
		/** 收益人姓名        **/
		public final static @type(String.class) @like String incomerName="incomerName";
	 			
			
	 	
			
		/** 贡献人  [Member]      **/
		public final static @type(Long.class)  String contributor="contributor";
	 			
			
	 	
			
		/** 收益人  [Member]      **/
		public final static @type(Long.class)  String beneficiary="beneficiary";
	 			
			
	 	
			
		/** 订单编号        **/
		public final static @type(String.class)  String orderNumber="orderNumber";
	 			
			
	 	
			
		/** 品牌信息  [Merchant]      **/
		public final static @type(Long.class)  String brands="brands";
	 			
			
	 	
			
		/** 结算情况    1:待结算 2:已结算     **/
		public final static @type(Short.class)  String endStatus="endStatus";
	 			
			
	 	
			
		/** 修改时间 [非空]       **/
		public final static @type(Date.class)  String updateTime="updateTime";
	 			
	 	/** and update_time >= ? */
 		public final static @type(Date.class) String updateTimeStart="updateTimeStart";
 		/** and update_time <= ? */
 		public final static @type(Date.class) String updateTimeEnd="updateTimeEnd";
				
			
	 	
			
		/** 添加时间 [非空]       **/
		public final static @type(Date.class)  String addTime="addTime";
	 			
	 	/** and add_time >= ? */
 		public final static @type(Date.class) String addTimeStart="addTimeStart";
 		/** and add_time <= ? */
 		public final static @type(Date.class) String addTimeEnd="addTimeEnd";
				
			
	 	
			
		/** 状态 [非空]   1:正常 0:无效     **/
		public final static @type(Short.class)  String status="status";
	 			
			
	 	
	 	public static String get(String name){
			try {
				Field field = F.class.getField(name);
				if(field!=null)
					return field.get(null).toString();
			} catch (Exception e) {
				//e.printStackTrace();
			}
			return null;
		}
	}
	
	
	
	/** 对象的数据库字段描述 **/
	public static enum C{
		
		id("id"),
		userType("user_type"),
		source("source"),
		revenueType("revenue_type"),
		income("income"),
		headPortrait("head_portrait"),
		fullName("full_name"),
		incomersName("incomers_name"),
		incomerName("incomer_name"),
		contributor("contributor"),
		beneficiary("beneficiary"),
		orderNumber("order_number"),
		brands("brands"),
		endStatus("end_status"),
		updateTime("update_time"),
		addTime("add_time"),
		status("status"),
		count("count");
		String column;
		C(String column){
			this.column = column;
		}
		public String toString(){
			return this.column;
		}
		public static String get(String name){
			try {
				Field field = C.class.getField(name);
				if(field!=null)
					return field.get(null).toString();
			} catch (Exception e) {
				//e.printStackTrace();
			}
			return null;
		}
	}
	
	
	
	
	/**
	* 获取会员收益记录数据
	**/
	public static Object getData(Object param){
		if(param==null)
			return null;
		Object value = null;
		if(param.getClass()==Long.class)
			value = IncomeRecord.get((Long)param);
		else if(param instanceof java.util.Map){
			java.util.Map params = (Map) param;
			if(params.get("size")==null)
				value = IncomeRecord.getIncomeRecord(params);
			else
				value = IncomeRecord.getIncomeRecordList(params, (Integer) params.get("size"));
		}else if(param.getClass()==Long.class )
			value =  IncomeRecord.where().id(param).get();
		else if(!Utils.empty(param.toString()))
			value = IncomeRecord.get(Long.valueOf(param.toString()));
		return value;
	}
	
	/**对象转json**/
	public Map toJSON(){
		return toJSON(false);
	}
	public Map toJSON(boolean simple){
		return toJSON(simple,0);
	}
	public Map toJSON(boolean simple,int step){
		Map map = new HashMap();
		map.put("id",this.getId());
	
		Utils.fms(map,simple?"":"id",this.getId(),this.getId$());
		
			
 		
	
		Utils.fms(map,simple?"type":"userType",this.getUserType(),this.getUserType$());
		
			
 		
	
		Utils.fms(map,simple?"":"source",this.getSource(),this.getSource$());
		
			
 		
	
		Utils.fms(map,simple?"type":"revenueType",this.getRevenueType(),this.getRevenueType$());
		
			
 		
	
		Utils.fms(map,simple?"":"income",this.getIncome(),this.getIncome$());
		
			
 		
	
		Utils.fms(map,simple?"portrait":"headPortrait",this.getHeadPortrait(),this.getHeadPortrait$());
		
			
 		
	
		Utils.fms(map,simple?"name":"fullName",this.getFullName(),this.getFullName$());
		
			
 		
	
		Utils.fms(map,simple?"name":"incomersName",this.getIncomersName(),this.getIncomersName$());
		
			
 		
	
		Utils.fms(map,simple?"name":"incomerName",this.getIncomerName(),this.getIncomerName$());
		
			
 		
	
		Utils.fms(map,simple?"":"contributor",this.getContributor(),this.getContributor$());
		
			
 		
	
		Utils.fms(map,simple?"":"beneficiary",this.getBeneficiary(),this.getBeneficiary$());
		
			
 		
	
		Utils.fms(map,simple?"number":"orderNumber",this.getOrderNumber(),this.getOrderNumber$());
		
			
 		
	
		Utils.fms(map,simple?"":"brands",this.getBrands(),this.getBrands$());
		
			
 		
	
		Utils.fms(map,simple?"status":"endStatus",this.getEndStatus(),this.getEndStatus$());
		
			
 		
	
		Utils.fms(map,simple?"time":"updateTime",this.getUpdateTime(),this.getUpdateTime$());
		
			
 		
	
		Utils.fms(map,simple?"time":"addTime",this.getAddTime(),this.getAddTime$());
		
			
 		
	
		Utils.fms(map,simple?"":"status",this.getStatus(),this.getStatus$());
		
			
 		
	
		if(this.suffix!=null)map.put("suffix", this.suffix);
		
		/************LAZY3Q_DEFINE_TOJSON************/
		/************LAZY3Q_DEFINE_TOJSON************/
		return map;
	}
	/**对象转map**/
	public Map toMap(){
		Map map = new HashMap();
	
		map.put("id",this.getId());
 		
	
		map.put("userType",this.getUserType());
 		
	
		map.put("source",this.getSource());
 		
	
		map.put("revenueType",this.getRevenueType());
 		
	
		map.put("income",this.getIncome());
 		
	
		map.put("headPortrait",this.getHeadPortrait());
 		
	
		map.put("fullName",this.getFullName());
 		
	
		map.put("incomersName",this.getIncomersName());
 		
	
		map.put("incomerName",this.getIncomerName());
 		
	
		map.put("contributor",this.getContributor());
 		
	
		map.put("beneficiary",this.getBeneficiary());
 		
	
		map.put("orderNumber",this.getOrderNumber());
 		
	
		map.put("brands",this.getBrands());
 		
	
		map.put("endStatus",this.getEndStatus());
 		
	
		map.put("updateTime",this.getUpdateTime());
 		
	
		map.put("addTime",this.getAddTime());
 		
	
		map.put("status",this.getStatus());
 		
	
		map.put("suffix", this.suffix);
		
		/************LAZY3Q_DEFINE_TOMAP************/
		/************LAZY3Q_DEFINE_TOMAP************/
		return map;
	}
	/**map转对象**/
	public static IncomeRecord fromMap(Map map){
		IncomeRecord incomeRecord = new IncomeRecord();
	
		incomeRecord.id = Utils.parseLong(map.get("id"));
 		
	
		incomeRecord.userType = Utils.parseShort(map.get("userType"));
 		
	
		incomeRecord.source = Utils.parseShort(map.get("source"));
 		
	
		incomeRecord.revenueType = Utils.parseShort(map.get("revenueType"));
 		
	
		incomeRecord.income = Utils.parseDouble(map.get("income"));
 		
	
		incomeRecord.headPortrait = Utils.parseString(map.get("headPortrait"));
 		
	
		incomeRecord.fullName = Utils.parseString(map.get("fullName"));
 		
	
		incomeRecord.incomersName = Utils.parseString(map.get("incomersName"));
 		
	
		incomeRecord.incomerName = Utils.parseString(map.get("incomerName"));
 		
	
		incomeRecord.contributor = Utils.parseLong(map.get("contributor"));
 		
	
		incomeRecord.beneficiary = Utils.parseLong(map.get("beneficiary"));
 		
	
		incomeRecord.orderNumber = Utils.parseString(map.get("orderNumber"));
 		
	
		incomeRecord.brands = Utils.parseLong(map.get("brands"));
 		
	
		incomeRecord.endStatus = Utils.parseShort(map.get("endStatus"));
 		
	
		incomeRecord.updateTime = Utils.parseDate(map.get("updateTime"));
 		
	
		incomeRecord.addTime = Utils.parseDate(map.get("addTime"));
 		
	
		incomeRecord.status = Utils.parseShort(map.get("status"));
 		
	
		return incomeRecord;
	}
	
	
	/**字段设置标记队列**/
	private Map<String,Boolean> seted=new HashMap();
	public Boolean getSeted(String key){
		return seted.get(key);
	}
	public void setSeted(String key){
		seted.put(key,true);
	}
	/**同步未set的字段**/
	public void mergeSet(IncomeRecord old){
		Field[] fields = this.getClass().getDeclaredFields();
		try {
			for(Field field:fields){
				String key = field.getName();
				if(seted.get(key)==null && field.getAnnotation(column.class)!=null){
					field.setAccessible(true);
					field.set(this, field.get(old));					
				}
			}
		} catch (Exception e) {
			throw new RuntimeException(e);
		}
	}
	
		
	/**自定义变量存储**/
	private Map values=new HashMap();
	public Map getValues(){
		return values;
	}
	public void setValues(String name,Object value){
		values.put(name,value);
	}
	
	/**分表时的表名后缀**/
	private String suffix;
	public String getSuffix() {
		return suffix;
	}
	public void setSuffix(String suffix) {
		this.suffix = suffix;
	}
	
	
	/**获取数据库名称**/
	public static String getDataBaseName(){
		return Utils.config("spring.datasource.distribute_sys.name");
	}
	
	
	public static String getIcon(){
		return "/images/icons/1702680819.png";
	}
	public static String getIconfont(){
		return "icon-jinbi";
	}
	public static enum ACT{
		列表,添加,修改,详情
	};
	public static String getUrl(ACT act,IncomeRecord.M params){
		if(params==null)params=new IncomeRecord.M(0);
		params.remove("joins");
		params.remove("definexs");
		params.remove("distinct");
		String strUrl = "/admin/finance/incomerecord.edit.html?";
		if(params.get("id")!=null){
			strUrl+="&id="+Utils.encode(""+params.get("id"),Utils.UTF8);
		}
		if(act==ACT.列表){
			strUrl = "/admin/finance/incomerecord.html?1=1";
		
		}else if(act==ACT.添加){
			strUrl+="&edittype=insert";
		
		
		}else if(act==ACT.修改){
			strUrl+="&edittype=update";
		
		}else if(act==ACT.详情){
			strUrl+="&edittype=detail";
		
		}		
		if(params!=null){
			for(Object key:params.keySet()){
				strUrl+="&"+key+"="+Utils.encode(""+params.get(key),Utils.UTF8)+"";
			}
		}
		return strUrl;
	}
	public String getDetailUrl(){
		return this.getUrl(ACT.详情, where.id(this.getId()));
	}
	
	/**
	* 转跳到当前地址
	**/
	public static Protocol redirect(IncomeRecord.ACT act,IncomeRecord.M params){
		Protocol protocol = Protocol.create(true,null,"ACT_REDIRECT");
		protocol.set("url",IncomeRecord.getUrl(act, params));
		return protocol;
	}
	/**
	* 打开一个新的tab页面
	**/
	public static Protocol href(IncomeRecord.ACT act,IncomeRecord.M params){
		Protocol protocol = Protocol.create(true,null,"ACT_HREF");
		protocol.set("url",IncomeRecord.getUrl(act, params));
		protocol.set("title",act.name());
		return protocol;
	}
	/**
	* 显示一个消息框，并且关闭当前的对话框
	**/
	public static Protocol message(String message){
		Protocol protocol = Protocol.create(true,null,"ACT_MESSAGE");
		protocol.set("message",message);
		return protocol;
	}
	
	
	static com.distribute.framework.dao.IIncomeRecordDao getIncomeRecordDao(){
		return Utils.getBean("incomeRecordDao");
	};
	
}